﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using OA.BLL;
using OA.Web.Code;
using System;
using System.Linq;
using X.PagedList;
using Z.EntityFramework.Plus;


namespace OA.Web.Areas.Admin.Controllers
{
    public class CacheController : BaseAdminController
    {
        private IMemoryCache _cache;
        public CacheController(ICookie cookie, IHttpContextAccessor accessor, IMemoryCache cache) : base(accessor,cookie, cache)
        {
            _cache = cache;
        }

        public IActionResult UpdateCache()
        {
            foreach (string key in CacheHelper.CacheKeys)
            {
                _cache.Remove(key);
            }
            return Redirect("/Admin/Home/ShowInfo?msg=缓存清除成功");
        }
	}
}